﻿@model Test.DataAccess.POCO.Permission

@{
    bool isEdit = ViewBag.IsEdit;
    string title = isEdit ? "编辑" : "创建";
}

@section Styles{
    @Styles.Render(BundleConfig.BootstrapUploadCssBundle)
    <style type="text/css">
    </style>
}
@section Scripts{
    @Scripts.Render(BundleConfig.BootstrapUploadJsBundle)
    <script type="text/javascript">
        $(function () {
            Toolbox.Notifier.info("提示：请小心操作本页面");
        });
    </script>
}


<!-- BEGIN FORM PORTLET -->
<div class="portlet">
    <div class="portlet-title">
        <div class="caption">
            <i class="fa fa-reorder"></i>@(title)权限
        </div>
    </div>
    <div class="portlet-body form">
        @using (Html.BeginForm("CreateOrEditPermission", "Account", FormMethod.Post,
                            new { @class = "form-horizontal js-form js-ajax-form", enctype = "multipart/form-data" }))
        {
            @Html.AntiForgeryToken()
            @Html.HiddenFor(m => m.Id)
            @Html.Hidden("isEdit", isEdit)
            <div class="form-body">
                <div class="form-group">
                    <label class="col-md-3 control-label">
                        @Html.DisplayNameFor(m => m.PermissionName)
                    </label>
                    <div class="col-md-7">
                        @Html.TextBoxFor(m => m.PermissionName, new { @class = "form-control" })
                        @Html.ValidationMessageFor(m => m.PermissionName)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">
                        @Html.DisplayNameFor(m => m.Description)
                    </label>
                    <div class="col-md-7">
                        @Html.TextAreaFor(m => m.Description, new { @class = "form-control" })
                        @Html.ValidationMessageFor(m => m.Description)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">
                        @Html.DisplayNameFor(m => m.IsMenu)
                    </label>
                    <div class="col-md-7">
                        @Html.CheckBoxFor(m => m.IsMenu, new { @class = "form-control" })
                        @Html.ValidationMessageFor(m => m.IsMenu)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">
                        @Html.DisplayNameFor(m => m.Parent_Id)
                    </label>
                    <div class="col-md-7">
                        @Html.DropDownListFor(m => m.Parent_Id, (IEnumerable<SelectListItem>)ViewBag.PermissionSelectItems, new { @class = "form-control select2 " })
                        @Html.ValidationMessageFor(m => m.Parent_Id)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">
                        @Html.DisplayNameFor(m => m.Order)
                    </label>
                    <div class="col-md-7">
                        @Html.TextBoxFor(m => m.Order, new { @class = "form-control" })
                        @Html.ValidationMessageFor(m => m.Order)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">
                        @Html.DisplayNameFor(m => m.CssClass)
                    </label>
                    <div class="col-md-7">
                        @Html.TextBoxFor(m => m.CssClass, new { @class = "form-control" })
                        @Html.ValidationMessageFor(m => m.CssClass)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">
                        @Html.DisplayNameFor(m => m.Controller)
                    </label>
                    <div class="col-md-7">
                        @Html.TextAreaFor(m => m.Controller, new { @class = "form-control" })
                        @Html.ValidationMessageFor(m => m.Controller)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">
                        @Html.DisplayNameFor(m => m.Action)
                    </label>
                    <div class="col-md-7">
                        @Html.TextAreaFor(m => m.Action, new { @class = "form-control" })
                        @Html.ValidationMessageFor(m => m.Action)
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-md-3 control-label">
                        @Html.DisplayNameFor(m => m.Url)
                    </label>
                    <div class="col-md-7">
                        @Html.TextAreaFor(m => m.Url, new { @class = "form-control" })
                        @Html.ValidationMessageFor(m => m.Url)
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-md-offset-3 col-md-7">
                        @Html.ValidationSummary()
                    </div>
                </div>
            </div>
            <div class="form-actions fluid">
                <div class="col-md-offset-3 col-md-9">
                    <button type="submit" class="btn btn-success">保存</button>
                    <a href="@HttpContext.Current.Request.UrlReferrer" class="btn btn-default">取消</a>
                </div>
            </div>
        }
    </div>
</div>